package ru.jexp.rcp.supply.beans.ek;

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

import ru.jexp.izdelie.mestoizgotovlenia.IMestoIzgotovlenia;
import ru.jexp.izdelie.sborocnaaedinica.SborocnaaEdinica;
import ru.jexp.rcp.supply.mui.JExpSupplyMessages;
import ru.jexp.rcp.supply.swtext.DecimalFormatter;
import ru.jexp.rcp.supply.swtext.EdizmerCombo;
import ru.jexp.rcp.supply.swtext.JExpControlLookup;
import ru.jexp.rcp.supply.swtext.JExpDecimal;
import ru.jexp.rcp.supply.swtext.JExpDialogAdapter;
import ru.jexp.rcp.supply.swtext.factory.JExpControlFactory;
import ru.jexp.rcp.supply.swtext.factory.JExpDecorationFactory;
import ru.jexp.rcp.supply.swtext.factory.JExpLayoutFactory;
import ru.jexp.rcp.supply.swtext.factory.JExpLookupFactory;

public class SeProjForm extends JExpDialogAdapter implements SeProjFormPresenter.IVeiw
{

	private JExpControlLookup<SborocnaaEdinica> ek;
	private JExpDecimal edizmerValue;
	private EdizmerCombo edizmer;
	private JExpControlLookup<IMestoIzgotovlenia> pf;

	public SeProjForm(Shell parentShell)
	{
		super(parentShell);
	}

	@Override
	protected String createTitle()
	{
		return JExpSupplyMessages.Ek_addform_se_title;
	}

	@Override
	protected void createControls(Composite parent)
	{
		parent.setLayout(new GridLayout(3, false));
		parent.setLayoutData(JExpLayoutFactory.gdFillBoth());
		ek = JExpLookupFactory.createSeLookup(parent, 200);
		JExpDecorationFactory.labelDecoration(ek.getLabel());
		ek.setLayoutData(JExpLayoutFactory.gdWithHorizontalSpanHorizontalSize(2, 200));
		JExpControlFactory.createLabel(parent, JExpSupplyMessages.Ek_addform_kolvo);
		edizmerValue = JExpControlFactory.createDecimal(parent, DecimalFormatter.EDIT_MASK_2);
		edizmerValue.setLayoutData(JExpLayoutFactory.gdWithSizeHorizontal(50));
		edizmer = new EdizmerCombo(parent);
		edizmer.initValues();
		pf = JExpLookupFactory.createPfLookup(parent, 200);
		pf.setLayoutData(JExpLayoutFactory.gdWithHorizontalSpanHorizontalSize(2, 200));
	}

	@Override
	public void createView()
	{
		create();
	}

	@Override
	public int openView()
	{
		return open();
	}

	@Override
	public JExpControlLookup<SborocnaaEdinica> getEk()
	{
		return ek;
	}

	@Override
	public JExpDecimal getEdizmerValue()
	{
		return edizmerValue;
	}

	@Override
	public EdizmerCombo getEdizmer()
	{
		return edizmer;
	}

	@Override
	public JExpControlLookup<IMestoIzgotovlenia> getPf()
	{
		return pf;
	}

}
